/*
 * UMLSynch plugin for Eclipse
 * http://umlsynch.googlecode.com
 *
 * Copyright 2008-2010, Evgeny Alexeyev
 * Licensed under the EPL - v1.0
 * http://www.eclipse.org/legal/epl-v10.html
 *
 */

package com.googlecode.umlsynch.EclipseDNDWrapper;

import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.ui.PlatformUI;

import com.googlecode.umlsynch.eclipse.rpc.Debug.TEclipseDebug;

public class EclipseKeysListener implements Listener{

	private TEclipseDebug debug = new TEclipseDebug("KeyListener");
	
	@Override
	public void handleEvent(Event event) {
		if (16777228 == event.keyCode)
		  debug.Debug("Recieved: F3");
	}
	
	public EclipseKeysListener() {}
	public void RegistListener() {
			debug.Debug("Add filter");

			PlatformUI.getWorkbench().getDisplay().addFilter(SWT.KeyDown, this);
//			debug.Debug("Add filter 2"); 
			PlatformUI.getWorkbench().getDisplay().addFilter(SWT.ALT, this);
//			debug.Debug("Add filter 3");
			PlatformUI.getWorkbench().getDisplay().addFilter(SWT.KEY_MASK, this);
//			debug.Debug("Add filter 3");
			PlatformUI.getWorkbench().getDisplay().addListener(SWT.F4, this);
			PlatformUI.getWorkbench().getDisplay().addListener(SWT.F3, this);

		//	debug.Debug("Add filter 3");
			PlatformUI.getWorkbench().getDisplay().addListener(SWT.CONTROL, this);

	//		debug.Debug("Add filter 3");
			PlatformUI.getWorkbench().getDisplay().addListener(SWT.ALT, this);

	}

	void DestroyEclipseKeysListener() {
		PlatformUI.getWorkbench().getDisplay().removeFilter(SWT.F3, this);
	}
}
